<?php
namespace app\appclass\model;
use app\BaseModel;
use think\facade\Db;



class StoreInfo extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_appclass_store_info';


    /**
     * @author chenniang
     * @DataTime: 2021-05-18 17:08
     * @功能说明:
     */
    public function getBusinessLicenseAttr($value,$data){

        if(!empty($data['business_license'])){

            return explode(',',$data['business_license']);
        }



    }
    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:00
     * @功能说明:添加
     */
    public function dataAdd($data){

        $res = $this->insert($data);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:03
     * @功能说明:编辑
     */
    public function dataUpdate($dis,$data){

        $res = $this->where($dis)->update($data);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:04
     * @功能说明:详情
     */
    public function dataInfo($dis){

        $data = $this->where($dis)->find();

        if(empty($data)){

            $dis['text'] = '';

            $this->insert($dis);

            $data = $this->where($dis)->find();

        }

        return !empty($data)?$data->toArray():[];

    }


    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:05
     * @功能说明:
     */
    public function dataList($dis,$page=10){

        $data = $this->where($dis)->where('status','>',-1)->order('id desc')->paginate($page)->toArray();

        return $data;

    }







}